﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="addSkill.aspx.cs" Inherits="Staff_skill_addSkill" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>新增技能資料</title>
    <style type="text/css">


        .style1
        {
            font-family: 微軟正黑體;
            font-size: xx-large;
            text-align: center;
        }
        .style2
        {
            text-align: center;
        }
        .style3
        {
            width: 79%;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="style2">
    
        <span class="style1">新增技能資料</span><br />
        <br />
        <table align="center" class="style3">
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                        BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" 
                        CellPadding="4" DataKeyNames="SkillId" DataSourceID="SqlDataSource1" 
                        DefaultMode="Insert" Height="96px" Width="490px">
                        <EditRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                        <Fields>
                            <asp:BoundField DataField="SkillId" HeaderText="SkillId" InsertVisible="False" 
                                ReadOnly="True" SortExpression="SkillId" />
                            <asp:BoundField DataField="SkillName" HeaderText="名稱" 
                                SortExpression="SkillName" />
                            <asp:TemplateField HeaderText="介紹" SortExpression="Intro">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Intro") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Height="91px" 
                                        Text='<%# Bind("Intro") %>' TextMode="MultiLine" Width="208px"></asp:TextBox>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("Intro") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField ButtonType="Button" ShowInsertButton="True" />
                        </Fields>
                        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                        <RowStyle BackColor="White" ForeColor="#003399" />
                    </asp:DetailsView>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                        BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" 
                        CellPadding="4" DataKeyNames="SkillId" DataSourceID="SqlDataSource1" 
                        Width="488px">
                        <Columns>
                            <asp:BoundField DataField="SkillId" HeaderText="ID" InsertVisible="False" 
                                ReadOnly="True" SortExpression="SkillId" />
                            <asp:BoundField DataField="SkillName" HeaderText="名稱" 
                                SortExpression="SkillName" />
                            <asp:BoundField DataField="Intro" HeaderText="介紹" SortExpression="Intro" />
                            <asp:CommandField ButtonType="Button" ShowDeleteButton="True" 
                                ShowEditButton="True" />
                        </Columns>
                        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                        <RowStyle BackColor="White" ForeColor="#003399" />
                        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                        <SortedAscendingCellStyle BackColor="#EDF6F6" />
                        <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
                        <SortedDescendingCellStyle BackColor="#D6DFDF" />
                        <SortedDescendingHeaderStyle BackColor="#002876" />
                    </asp:GridView>
                </td>
            </tr>
        </table>
        <br />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ProjectConnectionString %>" 
            DeleteCommand="DELETE FROM [Skills] WHERE [SkillId] = @SkillId" 
            InsertCommand="INSERT INTO [Skills] ([SkillName], [Intro]) VALUES (@SkillName, @Intro)" 
            SelectCommand="SELECT * FROM [Skills] WHERE ([SkillId] &lt;&gt; @SkillId)" 
            
            UpdateCommand="UPDATE [Skills] SET [SkillName] = @SkillName, [Intro] = @Intro WHERE [SkillId] = @SkillId">
            <DeleteParameters>
                <asp:Parameter Name="SkillId" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="SkillName" Type="String" />
                <asp:Parameter Name="Intro" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:Parameter DefaultValue="3" Name="SkillId" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="SkillName" Type="String" />
                <asp:Parameter Name="Intro" Type="String" />
                <asp:Parameter Name="SkillId" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    
    </div>
    </form>
</body>
</html>
